package com.lzq.model.factory.func;

/**
 * @author : modify
 * @version : v1.0
 * @description :
 * @createTime : 2022/11/15 10:28
 * @updateUser : modify
 * @updateTime : 2022/11/15 10:28
 * @updateRemark :
 */
public class CoffeeStore {
    private CoffeeFactory coffeeFactory;

    public CoffeeStore(CoffeeFactory factory) {
        this.coffeeFactory = factory;
    }

    public Coffee orderCoffee() {
        Coffee coffee = coffeeFactory.createCoffee();
        coffee.addMilk();
        coffee.addSugar();
        return coffee;
    }
}

class Test {
    public static void main(String[] args) {
        UsaCoffeeFactory usaCoffeeFactory = new UsaCoffeeFactory();
        CoffeeStore coffeeStore = new CoffeeStore(usaCoffeeFactory);
        Coffee coffee = coffeeStore.orderCoffee();
        System.out.println(coffee.getName());
    }
}